extends Node

#var roomInfo={
#	'masterid':0,
#	'meta':{},
#	'nickname':'直播间',
#	'roomid':'123',
#	'_roomid':'123'
#}
var roomInfo=null
#存储用户数据  key:uid value:data
var userDic={
	
}
func start():
	DanMuReciver.connect("receive",self,'_onReceive',[],CONNECT_DEFERRED)
func _onReceive(data):
	if data!=null:
#		_setRoomInfo(data.roomInfo)
		_dealMessage(data)
	pass
	
#func _setRoomInfo(info):
#	if roomInfo==null:
#		roomInfo.info
#	pass

func _dealMessage(message):
	if message==null:
		return
	var cmd=G.objGet(message,'cmd')
	if cmd==null:
		return
	match cmd:
		'INTERACT_WORD': #加入直播间
			var data=message.data
			var uid=data.uid
			var uname=data.uname
			pass
		'ENTRY_EFFECT': #进场特效，比如 欢迎舰长xxx进入直播间。如果有这个，就没有INTERACT_WORD。
			pass
		'DANMU_MSG': #弹幕
			var info=message.info
			var text=message[1]
			
			pass
		'SEND_GIFT': #投喂
			
			pass
		'ONLINE_RANK_COUNT': #自己的排名，没用
			var count=message.cmd.count
			pass
		'WATCHED_CHANGE':  #多少人看过直播间
			pass
		'ONLINE_RANK_V2':
			pass
	pass
